Skip to content

fix(bigquery-jdbc): gate Storage Write API on direct VALUES inserts and unify write-path data conversion - #15079

Open
Neenu1995 wants to merge 1 commit into
mainfrom
fix/swa-insert-values-expressions
Open

Neenu1995 wants to merge 1 commit into
mainfrom
fix/swa-insert-values-expressions

Conversation

@Neenu1995

Copy link
Copy Markdown
Contributor

No description provided.

@Neenu1995
Neenu1995 requested review from a team as code owners November 19, 2026 14:59

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for the BigQuery Storage Write API in the JDBC driver, specifically optimizing single-row bulk INSERT statements with positional placeholders. It adds SQL parsing to identify eligible direct INSERT shapes, validates parameter compatibility, formats temporal and numeric types for the Write API, and manages the lifecycle of the stream writer asynchronously. Feedback on the changes suggests moving the ApiFutures.addCallback call inside the try block in BigQueryJdbcBulkInsertWriter to guarantee proper phaser deregistration and prevent potential hangs if callback registration fails.

Comment on lines +95 to 104
openRequestCount.register();
ApiFuture<AppendRowsResponse> future;
try {
future = jsonStreamWriter.append(data, offset);
} catch (Throwable t) {
openRequestCount.arriveAndDeregister();
throw t;
}
ApiFutures.addCallback(
future, new AppendCompleteCallback(this), MoreExecutors.directExecutor());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Moving the ApiFutures.addCallback call inside the try block ensures that if any exception occurs during callback registration, the phaser is correctly deregistered in the catch block. This prevents a potential hang during cleanup where the main thread waits indefinitely for the leaked phaser party. Catching Throwable here is appropriate as it is at a Future boundary to ensure all failures are captured.

    openRequestCount.register();
    try {
      ApiFuture<AppendRowsResponse> future = jsonStreamWriter.append(data, offset);
      ApiFutures.addCallback(
          future, new AppendCompleteCallback(this), MoreExecutors.directExecutor());
    } catch (Throwable t) {
      openRequestCount.arriveAndDeregister();
      throw t;
    }
References
  1. Catching Throwable instead of Exception is acceptable at Future boundaries or during stream cleanup in asynchronous operations to ensure all failures are captured and propagated.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant